package com.bdd.controller;

import com.bdd.common.AjaxResponseResult;
import com.bdd.dto.QueryDto;
import com.bdd.dto.UserDto;
import com.bdd.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author Bdd
 * @Description
 * @Date 2020/3/24 11:15
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Resource
    private UserService userService;

    //需要通过网关调用  http://localhost:8001/user/save
    @PostMapping("save")
    public AjaxResponseResult save(@RequestBody UserDto userDto){
        return userService.save(userDto);
    }


    @PostMapping("auth/{id}")
    public AjaxResponseResult auth(@PathVariable("id") Long id){
        return userService.auth(id);
    }

    @GetMapping("page")
    public AjaxResponseResult page(@RequestBody QueryDto queryDto){
        return userService.page(queryDto);
    }
}
